package tn.orange.canreminder.service;

import java.util.LinkedList;
import java.util.List;

import org.apache.http.NameValuePair;

import tn.orange.canreminder.conf.Config;
import tn.orange.canreminder.model.Country;
import tn.orange.canreminder.model.JSONCountries;
import tn.orange.canreminder.parse.GenericJsonParser;

public class CountryServiceImp implements CountryService {

	GenericJsonParser parser = new GenericJsonParser();

	@Override
	public List<Country> getAllCountries(List<NameValuePair> nameValuePairs)
			throws Exception {
		// TODO Auto-generated method stub

		parser.setOutput(JSONCountries.class);
		parser.setUrl(Config.countries);
		parser.setNameValuePairs(nameValuePairs);
		JSONCountries object = (JSONCountries) parser.parse();
		List<Country> countries = object.getCountries();
		return countries;

	}

}
